package com.fl.service;

import com.fl.dao.OrdersDao;
import com.fl.dto.OrdersDo;
import com.fl.entity.Orders;
import com.fl.mapper.OrdersHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrdersService {

    @Autowired
    private OrdersDao ordersDao;

    public OrdersDo save(String id,String userId,int count,float total){
        Orders orders = new Orders();
        orders.setOrderId(id);
        orders.setUserId(userId);
        orders.setOrderNumber(count);
        orders.setTotalPrice(total);
        ordersDao.save(orders);
        return OrdersHelper.INSTANCE.transform4Update(new OrdersDo(),orders);
    }
}
